<template>
	<el-card shadow="never" header="个人信息">
		<el-form ref="form" :model="form" label-width="120px" style="margin-top:20px;">
			<el-form-item label="账号">
				<el-input v-model="form.user" disabled></el-input>
				<div class="el-form-item-msg">账号信息用于登录，系统不允许修改</div>
			</el-form-item>
			<el-form-item label="姓名">
				<el-input v-model="form.name"></el-input>
			</el-form-item>
			<el-form-item label="新密码">
				<el-input type="password" v-model="form.pwd"></el-input>
			</el-form-item>
			<el-form-item label="再次输入新密码">
				<el-input type="password" v-model="form.repwd"></el-input>
			</el-form-item>
			<el-form-item label="">
				<el-button type="primary" @click="resetPwd">提 交</el-button>
			</el-form-item>
		</el-form>
	</el-card>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					user: this.$TOOL.data.get("USER_INFO").manage.name,
					name: this.$TOOL.data.get("USER_INFO").manage.tname,
					pwd: "",
					repwd: "",
				}
			}
		},
		mounted() {
			
		},
		methods: {
			async resetPwd() {

				if (this.form.pwd != this.form.repwd) {
					this.$message.error('两次密码不一致')
					return 
				}

				var res = await this.$API.auth.resetpwd.post({pwd: this.form.pwd, repwd: this.form.repwd})

				if (res.code == 0) {
					this.$message.error(res.message)
					return 
				}

				this.$message.success(res.message)
				this.form.pwd = ""
				this.form.repwd = ""
			}
		}
	}
</script>

<style>
</style>
